package cn.chy.com.springbootdemo2.exception;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description: TODO
 * @author: 颜景琦
 * @date: 2021年10月18日 14:33
 */
@Setter
@Getter
@Configuration
@ConfigurationProperties(prefix = "qh")
@PropertySource(value = "classpath:exception-code.properties", encoding = "utf-8")
public class ExceptionConfig {


    private Map<Integer, String> codes = new HashMap<>();


    public String getMessage(int code) {

        return codes.get(code);
    }


}
